package cn.javass.xgen.util.readxml;

import org.w3c.dom.Element;

/**
 * 单个属性终结符
 */
public class PropertyTerminalExpression extends ReadXmlExpression {

    private String propName;

    public PropertyTerminalExpression(String propeName) {
        this.propName = propeName;
    }


    @Override
    public String[] interpret(Context ctx) {
        String[] ss = new String[1];
        //1.获取父元素
        Element ele = ctx.getPreEles().get(0);
        //2.取该元素的属性值
        ss[0] = ele.getAttribute(propName);
        return ss;
    }
}
